home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / programming / other / sounddt41src / compilerspecific.h < prev    next >
C/C++ Source or Header  |  1999-04-19  |  6KB  |  235 lines

  1. #ifndef COMPILERSPECIFIC_H
  2. #define COMPILERSPECIFIC_H
  3. /*
  4. **    $VER: CompilerSpecific.h 2.2 (1.10.97)
  5. **
  6. **    Copyright (C) 1997 Bernardo Innocenti. All rights reserved.
  7. **
  8. **    Compiler specific definitions is here. You can add support
  9. **    for other compilers in this header. Please return any changes
  10. **    you make to me, so I can add them to my personal copy of this file.
  11. **
  12. **    Here is a short description of the macros defined below:
  13. **
  14. **    LIBCALL
  15. **        Shared library entry point, with register args
  16. **
  17. **    HOOKCALL
  18. **        Hook or boopsi dispatcher entry point with arguments
  19. **        passed in registers
  20. **
  21. **    INLINE
  22. **        Please put function body inline to the calling code
  23. **
  24. **    STDARGS
  25. **        Function uses standard C conventions for arguments
  26. **
  27. **    ASMCALL
  28. **        Function takes arguments in the specified 68K registers
  29. **
  30. **    REGCALL
  31. **        Function takes arguments in registers choosen by the compiler
  32. **
  33. **    CONSTCALL
  34. **        Function does not modify any global variable
  35. **
  36. **    FORMATCALL(archetype,string_index,first_to_check)
  37. **        Function uses printf or scanf-like formatting
  38. **
  39. **    SAVEDS
  40. **        Function needs to reload context for small data model
  41. **
  42. **    INTERRUPT
  43. **        Function will be called from within an interrupt
  44. **
  45. **    NORETURN
  46. **        Function does never return
  47. **
  48. **    ALIGNED
  49. **        Variable must be aligned to longword boundaries
  50. **
  51. **    CHIP
  52. **        Variable must be stored in CHIP RAM
  53. **
  54. **    REG(reg,arg)
  55. **        Put argument <arg> in 68K register <reg>
  56. **
  57. **    min(a,b)
  58. **        Return the minimum between <a> and <b>
  59. **
  60. **    max(a,b)
  61. **        Return the maximum between <a> and <b>
  62. **
  63. **    abs(a)
  64. **        Return the absolute value of <a>
  65. **
  66. **    _COMPILED_WITH
  67. **        A string containing the name of the compiler
  68. */
  69.  
  70. #ifdef __SASC
  71.     /* SAS/C 6.58 or better */
  72.  
  73.     #define INLINE        static __inline
  74.     #define STDARGS        __stdargs
  75.     #define ASMCALL        __asm
  76.     #define REGCALL        __regcall
  77.     #define CONSTCALL    /* unsupported */
  78.     #define FORMATCALL    /* unsupported */
  79.     #define SAVEDS        __saveds
  80.     #define INTERRUPT    __interrupt
  81.     #define NORETURN    /* unsupported */
  82.     #define ALIGNED        __aligned
  83.     #define CHIP        __chip
  84.     #define REG(reg,arg) register __##reg arg
  85.     #define _COMPILED_WITH    "SAS/C"
  86.  
  87.     /* For min(), max() and abs() */
  88.     #define USE_BUILTIN_MATH
  89.     #include <string.h>
  90. #else
  91. #ifdef __GNUC__
  92.     /* GeekGadgets GCC 2.7.2.1 or better */
  93.  
  94.     #define INLINE        static inline
  95.     #define STDARGS        __attribute__((stkparm))
  96.     #define ASMCALL        /* nothing */
  97.     #define REGCALL        /* nothing */
  98.     #define CONSTCALL    __attribute__((const))
  99.     #define FORMATCALL(a,s,f)    __attribute__((format(a,s,f)))
  100.     #define SAVEDS        __attribute__((saveds))
  101.     #define INTERRUPT    __attribute__((interrupt))
  102.     #define NORETURN    __attribute__((noreturn))
  103.     #define ALIGNED        __attribute__((aligned(4)))
  104.     #define REG(reg,arg) arg __asm(#reg)
  105.     #define _COMPILED_WITH    "GCC"
  106.  
  107.     #define min(a,b)    (((a)<(b))?(a):(b))
  108.     #define max(a,b)    (((a)>(b))?(a):(b))
  109.     #define abs(a)        (((a)>0)?(a):-(a))
  110.  
  111.     /* GCC produces code which calls these two functions
  112.      * to initialize and copy structures and arrays.
  113.      */
  114.     void INLINE STDARGS bzero (char *buf, int len)
  115.         { while (len--) *buf++ = 0; }
  116.  
  117.     void INLINE STDARGS bcopy (char *src, char *dest, int len)
  118.         { while (len--) *dest++ = *src++; }
  119.  
  120. #else
  121. #ifdef __STORM__
  122.     /* StormC 2.00.23 or better */
  123.     #define INLINE        __inline
  124.     #define STDARGS        /* nothing */
  125.     #define ASMCALL        /* nothing */
  126.     #define REGCALL        register
  127.     #define CONSTCALL    /* unsupported */
  128.     #define FORMATCALL    /* unsupported */
  129.     #define SAVEDS        __saveds
  130.     #define INTERRUPT    __interrupt
  131.     #define NORETURN    /* unsupported */
  132.     #define ALIGNED        /* unsupported */
  133.     #define CHIP        __chip
  134.     #define REG(reg,arg) register __##reg arg
  135.     #define _COMPILED_WITH    "StormC"
  136.  
  137.     #define min(a,b)    (((a)<(b))?(a):(b))
  138.     #define max(a,b)    (((a)>(b))?(a):(b))
  139.     #define abs(a)        (((a)>0)?(a):-(a))
  140.  
  141.     #define _INLINE_INCLUDES
  142.     #include <string.h>
  143. #else
  144. #ifdef __MAXON__
  145.     /* Maxon C/C++ */
  146.  
  147.     #define INLINE        static inline
  148.     #define STDARGS        /* ? */
  149.     #define ASMCALL        /* ? */
  150.     #define REGCALL        /* ? */
  151.     #define CONSTCALL    /* unsupported */
  152.     #define FORMATCALL    /* unsupported */
  153.     #define SAVEDS        __saveds
  154.     #define INTERRUPT    __interrupt
  155.     #define NORETURN    /* unsupported */
  156.     #define ALIGNED        __aligned
  157.     #define REG(reg,arg) register __##reg arg
  158.     #define _COMPILED_WITH    "Maxon C"
  159.  
  160.     /* For min(), max() and abs() */
  161.     #define USE_BUILTIN_MATH
  162.     #include <string.h>
  163.  
  164.     #error Maxon C compiler support is untested. Please check all the above definitions
  165. #else
  166. #ifdef _DCC
  167.     /* DICE C */
  168.  
  169.     #define INLINE        static __inline
  170.     #define STDARGS        __stdargs
  171.     #define ASMCALL        /* nothing */
  172.     #define REGCALL        /* ? */
  173.     #define CONSTCALL    /* unsupported */
  174.     #define FORMATCALL    /* unsupported */
  175.     #define SAVEDS        __geta4
  176.     #define INTERRUPT    /* unsupported */
  177.     #define NORETURN    /* unsupported */
  178.     #define ALIGNED        __aligned
  179.     #define REG(reg,arg)    __##reg arg
  180.     #define _COMPILED_WITH    "DICE"
  181.  
  182.     #define min(a,b)    (((a)<(b))?(a):(b))
  183.     #define max(a,b)    (((a)>(b))?(a):(b))
  184.     #define abs(a)        (((a)>0)?(a):-(a))
  185.  
  186.     #error DICE compiler support is untested. Please check all the above definitions
  187. #else
  188. #ifdef AZTEC_C
  189.     /* Aztec/Manx C */
  190.  
  191.     #define INLINE        static
  192.     #define STDARGS        /* ? */
  193.     #define ASMCALL        /* ? */
  194.     #define REGCALL        /* ? */
  195.     #define CONSTCALL    /* unsupported */
  196.     #define FORMATCALL    /* unsupported */
  197.     #define SAVEDS        __geta4
  198.     #define INTERRUPT    /* unsupported */
  199.     #define NORETURN    /* unsupported */
  200.     #define ALIGNED        __aligned
  201.     #define REG(reg,arg)    __##reg arg
  202.     #define _COMPILED_WITH    "Manx C"
  203.  
  204.     #define min(a,b)    (((a)<(b))?(a):(b))
  205.     #define max(a,b)    (((a)>(b))?(a):(b))
  206.     #define abs(a)        (((a)>0)?(a):-(a))
  207.  
  208.     #error Aztec/Manx C compiler support is untested. Please check all the above definitions
  209. #else
  210.     #error Please add compiler specific definitions for your compiler
  211. #endif
  212. #endif
  213. #endif
  214. #endif
  215. #endif
  216. #endif
  217.  
  218.  
  219. /* Special function attributes */
  220.  
  221. #define LIBCALL        ASMCALL SAVEDS
  222. #define HOOKCALL    ASMCALL SAVEDS
  223.  
  224.  
  225. /* AROS Compatibility: IPTR is a type which can store a pointer
  226.  * as well as a long integer.
  227.  */
  228. #ifndef IPTR
  229. #define IPTR LONG
  230. #endif /* IPTR */
  231.  
  232.  
  233.  
  234. #endif /* !COMPILERSPECIFIC_H */
  235.